package com.ruoyi.ky450.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ky450.mapper.TargetAttachmentMapper;
import com.ruoyi.ky450.domain.TargetAttachment;
import com.ruoyi.ky450.service.ITargetAttachmentService;

/**
 * 目标附件Service业务层处理
 *
 * @author ruoyi
 * @date 2025-01-20
 */
@Service
public class TargetAttachmentServiceImpl extends ServiceImpl<TargetAttachmentMapper, TargetAttachment> implements ITargetAttachmentService
{
    @Autowired
    private TargetAttachmentMapper targetAttachmentMapper;

    /**
     * 查询目标附件
     *
     * @param id 目标附件主键
     * @return 目标附件
     */
    @Override
    public TargetAttachment selectTargetAttachmentById(Long id)
    {
        return targetAttachmentMapper.selectTargetAttachmentById(id);
    }

    /**
     * 查询目标附件列表
     *
     * @param targetAttachment 目标附件
     * @return 目标附件
     */
    @Override
    public List<TargetAttachment> selectTargetAttachmentList(TargetAttachment targetAttachment)
    {
        return targetAttachmentMapper.selectTargetAttachmentList(targetAttachment);
    }

    /**
     * 新增目标附件
     *
     * @param targetAttachment 目标附件
     * @return 结果
     */
    @Override
    public int insertTargetAttachment(TargetAttachment targetAttachment)
    {
        targetAttachment.setCreateTime(DateUtils.getNowDate());
        return targetAttachmentMapper.insert(targetAttachment);
    }

    /**
     * 修改目标附件
     *
     * @param targetAttachment 目标附件
     * @return 结果
     */
    @Override
    public int updateTargetAttachment(TargetAttachment targetAttachment)
    {
        targetAttachment.setUpdateTime(DateUtils.getNowDate());
        return targetAttachmentMapper.updateTargetAttachment(targetAttachment);
    }

    /**
     * 批量删除目标附件
     *
     * @param ids 需要删除的目标附件主键
     * @return 结果
     */
    @Override
    public int deleteTargetAttachmentByIds(Long[] ids)
    {
        return targetAttachmentMapper.deleteTargetAttachmentByIds(ids);
    }

    /**
     * 删除目标附件信息
     *
     * @param id 目标附件主键
     * @return 结果
     */
    @Override
    public int deleteTargetAttachmentById(Long id)
    {
        return targetAttachmentMapper.deleteTargetAttachmentById(id);
    }
}
